﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Linq;
using System.Web.Services;
using AKMII.DMRA.Common;
using System.Web.Script.Serialization;
using AKMII.DMRA.Business.Management;
using AKMII.DMRA.Business.Rule;
using System.Xml.Serialization;
namespace AKMII.DMRA.Web
{
    public partial class MDHomepage : System.Web.UI.Page
    {
        #region Protected Methods

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["cities"] == null)
                {
                    Response.Redirect("OrderMap.aspx");
                }
                this.hiddenIsOrder.Value = "0";
                OrderManager om = new OrderManager();
                Order order = om.GetOrder(User.Identity.Name,
                    int.Parse(Session["orderMonth"].ToString()), int.Parse(Session["orderYear"].ToString()));
                if (order == null)
                {
                    order = new Order();
                    order.PeroidMonth = int.Parse(Session["orderMonth"].ToString());
                    order.PeroidYear = int.Parse(Session["orderYear"].ToString());
                    order.AccountId = User.Identity.Name;
                }
                else
                {
                    if (order.IsPurchased)
                    {
                        this.hiddenIsOrder.Value = "1";
                    }
                }
                Session["isFilter"] = false;
                Session["sortDirection"] = "Ascending";
                ZipManager zm = new ZipManager();
                string city = Session["cities"].ToString();
                string[] cities = city.Split('|');
                List<string> citys = new List<string>();
                for (int i = 1; i < cities.Length; i++)
                {
                    citys.Add(cities[i]);
                }
                List<LeadBlock> zips = zm.GetZipsById(Session["UserName"].ToString(),
                    int.Parse(Session["orderMonth"].ToString()), int.Parse(Session["orderYear"].ToString()),
                    Session["county"].ToString(), citys);

                Session["Zips"] = zips;
                BindDropdownlist();
                BindDataList();
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!CurrentPeriod.IsOrderPeriod)
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),
                    "isOrderPeriod", "<script type='text/javascript'>alert('Sorry,you can not order now for the cut off date reached! ');</script>");
                BindDataList();
                return;
            }

            List<LeadBlock> zips = new List<LeadBlock>();
            zips = (List<LeadBlock>)Session["Zips"];
            OrderManager om = new OrderManager();
            Order order = om.GetOrder(User.Identity.Name, int.Parse(Session["orderMonth"].ToString()), int.Parse(Session["orderYear"].ToString()));
            if (order == null)
            {
                order = new Order();
                order.PeroidMonth = int.Parse(Session["orderMonth"].ToString());
                order.PeroidYear = int.Parse(Session["orderYear"].ToString());
                order.AccountId = User.Identity.Name;
            }
            else
            {
                if (order.IsPurchased)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),
                        "isPurchased", "<script type='text/javascript'>alert('You have already purchased order for this month! ');</script>");
                    BindDataList();
                    return;
                }
            }
            if (order.Zips == null)
            {
                order.Zips = new List<LeadBlock>();
            }
            else
            {
                order.Zips.Clear();
            }

            SetCurrentPageZips(zips);
            SetZipLeadType(ref zips, ref order);
            if (om.ManageOrder(order, Session["agentName"].ToString(), int.Parse(Session["orderWeek"].ToString())))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),
                    "Ordered", "<script type='text/javascript'>alert('Congratulations!You have saved successfully.');</script>");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),
                    "failed", "<script type='text/javascript'>alert('You are failed for this operation!');</script>");
            }

            zips.ForEach(zip =>
            {
                if (zip.IsOrderInOneALN && zip.IsOrderInOneBus && string.IsNullOrEmpty(zip.UserAssigned))
                {
                    zip.UserAssigned = Session["orderWeek"].ToString() + " " + Session["agentName"].ToString();
                }
            });

            Session["Zips"] = zips;
            BindDataList();
        }

        protected void SetZipLeadType(ref List<LeadBlock> zips, ref Order order)
        {
            for (int i = 0; i < zips.Count; i++)
            {
                if (zips[i].IsOrderInOneALN && zips[i].IsOrderInOneBus)
                {
                    zips[i].Type = OrderType.All;
                    order.Zips.Add(zips[i]);
                }
                else if (zips[i].IsOrderInOneALN)
                {
                    zips[i].Type = OrderType.ALN;
                    order.Zips.Add(zips[i]);
                }
                else if (zips[i].IsOrderInOneBus)
                {
                    zips[i].Type = OrderType.Business;
                    order.Zips.Add(zips[i]);
                }
            }
        }

        protected void DataList1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            List<LeadBlock> zips = (List<LeadBlock>)Session["Zips"];

            SetCurrentPageZips(zips);
            Session["Zips"] = zips;
            DataList1.PageIndex = e.NewPageIndex;

            BindDataList();
        }

        protected void btnUnSelect_Click(object sender, EventArgs e)
        {
            List<LeadBlock> zips = (List<LeadBlock>)Session["Zips"];

            zips.ForEach(zip =>
            {
                zip.IsOrderInOneALN = false;
                zip.IsOrderInOneBus = false;
            });

            Session["Zips"] = zips;
            BindDataList();
        }

        protected void btnFilter_Click(object sender, EventArgs e)
        {
            Session["isFilter"] = true;
            Session["FilterZip"] = this.comboBox.Text.Trim();
            //Session["FilterTerr"] = this.ddlFilterTerr.SelectedValue;
            Session["FilterCity"] = this.ddlFilterCity.SelectedValue;
            Session["FilterCounty"] = this.ddlFilterCounty.SelectedValue;
            Session["FilterState"] = this.ddlFilterState.SelectedValue;
            List<LeadBlock> zips = Session["Zips"] as List<LeadBlock>;
            SetCurrentPageZips(zips);
            Session["Zips"] = zips;

            DataList1.PageIndex = 0;
            BindDataList();
        }

        protected void GdvSort(object sender, GridViewSortEventArgs e)
        {
            List<LeadBlock> zips = new List<LeadBlock>();
            zips = (List<LeadBlock>)Session["Zips"];
            if (Session["sortDirection"].ToString() == "Ascending")
            {
                Session["sortDirection"] = "Descending";
                zips = zips.OrderBy(c => c.ZipName).ToList<LeadBlock>();
                DataList1.Columns[1].HeaderText = "Zip Code ▲";
            }
            else
            {
                Session["sortDirection"] = "Ascending";
                zips = zips.OrderByDescending(c => c.ZipName).ToList<LeadBlock>();
                DataList1.Columns[1].HeaderText = "Zip Code ▼";
            }
            if (this.hiddenIsOrder.Value == "0")
            {
                SetCurrentPageZips(zips);
            }
            Session["Zips"] = zips;
            BindDataList();
        }

        protected void btnClear_Click(object sender, EventArgs e)
        {
            Session["isFilter"] = false;
            Session["FilterZip"] = null;
            //Session["FilterTerr"] = null;
            Session["FilterCity"] = null;
            Session["FilterCounty"] = null;
            Session["FilterState"] = null;

            List<LeadBlock> zips = Session["Zips"] as List<LeadBlock>;
            SetCurrentPageZips(zips);
            var q = (from p in zips
                     orderby p.County, p.City, p.ZipId
                     select p);
            Session["Zips"] = q.ToList<LeadBlock>();
            DataList1.Columns[1].HeaderText = "Zip Code";
            Session["sortDirection"] = "Ascending";
            BindComboBox();
            //ddlFilterTerr.SelectedIndex = 0;
            ddlFilterCity.SelectedIndex = 0;
            ddlFilterCounty.SelectedIndex = 0;
            ddlFilterState.SelectedIndex = 0;
            DataList1.PageIndex = 0;
            BindDataList();
        }

        protected void DataList1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LeadBlock lb = e.Row.DataItem as LeadBlock;
                e.Row.ToolTip = string.Format("Active Stop Count:{0}\nLasped Stop Count:{1}\nNeighbor Stop Count:{2}\nBusiness Stop Count:{3}\nActive Lead Card Count:{4}\nLapsed Lead Card Count:{5}",
                    lb.ActiveLeadCount, lb.LapsedLeadCount, lb.NeighborLeadCount, lb.BusinessLeadCount, lb.RealActiveLeadCount, lb.RealLapsedLeadCount);
            }
        }

        #endregion

        #region Public Methods

        public string GetAgentNumber()
        {
            string agentNumber = string.Empty;

            User user = Session["CurrentUser"] as User;

            if (user != null)
            {
                agentNumber = user.AgentNumber.ToString();
            }
            else
            {
                FormsAuthentication.SignOut();
                Response.Redirect(Constants.LoginUrl);
            }

            return agentNumber;
        }

        public string GetActiveLeadCount()
        {
            string leadCount = string.Empty;

            User user = Session["CurrentUser"] as User;

            if (user != null)
            {
                leadCount = (user.AgentNumber * SystemConfiguration.CommonSetting.LeadPerAgent * 4).ToString();
            }
            else
            {
                FormsAuthentication.SignOut();
                Response.Redirect(Constants.LoginUrl);
            }

            return leadCount;
        }

        public string GetLatestMonthByCurrentMonth(int i)
        {
            DateTime current = new DateTime(int.Parse(Session["orderYear"].ToString()), int.Parse(Session["orderMonth"].ToString()), 1);

            return Utility.GetMonthName(current.AddMonths(i).Month).Substring(0, 3);
        }

        #endregion

        #region Private Methods

        private void SetCurrentPageZips(List<LeadBlock> zips)
        {
            for (int i = 0; i < DataList1.Rows.Count; i++)
            {
                for (int j = 12; j < DataList1.Rows[i].Cells.Count; j++)
                {
                    if (DataList1.Rows[i].Cells[j].Controls[1].GetType().Name == "CheckBox")
                    {
                        CheckBox cb = (CheckBox)DataList1.Rows[i].Cells[j].Controls[1];
                        if (cb.Enabled)
                        {
                            switch (j)
                            {
                                case 12:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFiveALN = cb.Checked;
                                    break;
                                case 13:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFiveBus = cb.Checked;
                                    break;
                                case 14:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFourALN = cb.Checked;
                                    break;
                                case 15:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFourBus = cb.Checked;
                                    break;
                                case 16:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInThreeALN = cb.Checked;
                                    break;
                                case 17:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInThreeBus = cb.Checked;
                                    break;
                                case 18:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInTwoALN = cb.Checked;
                                    break;
                                case 19:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInTwoBus = cb.Checked;
                                    break;
                                case 20:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInOneALN = cb.Checked;
                                    break;
                                case 21:
                                    zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInOneBus = cb.Checked;
                                    break;
                            }
                        }
                    }
                }
            }
        }

        private void BindDropdownlist()
        {
            List<LeadBlock> zips = Session["Zips"] as List<LeadBlock>;

            if (zips != null && zips.Count > 0)
            {
                List<string> cities = zips.Select(c => c.City).Distinct().ToList<string>();
                foreach (var city in cities)
                {
                    ddlFilterCity.Items.Add(city);
                }

                List<string> counties = zips.Select(c => c.County).Distinct().ToList<string>();
                foreach (var county in counties)
                {
                    ddlFilterCounty.Items.Add(county);
                }

                //List<string> territories = zips.Select(c => c.Territory).Distinct().ToList<string>();
                //foreach (var territory in territories)
                //{
                //    ddlFilterTerr.Items.Add(territory);
                //}

                List<string> states = zips.Select(c => c.State).Distinct().ToList<string>();
                foreach (var state in states)
                {
                    ddlFilterState.Items.Add(state);
                }
            }

            ddlFilterCity.Items.Insert(0, "All");
            ddlFilterCounty.Items.Insert(0, "All");
            //ddlFilterTerr.Items.Insert(0, "All");
            ddlFilterState.Items.Insert(0, "All");

            BindComboBox();

        }

        public void BindComboBox()
        {
            comboBox.Items.Clear();
            List<LeadBlock> zips = Session["Zips"] as List<LeadBlock>;
            if (zips != null)
            {
                foreach (var zipName in zips.Select(C => C.ZipName).Distinct())
                {
                    comboBox.Items.Add(zipName);
                }
            }

            comboBox.Items.Add(string.Empty);
            comboBox.SelectedIndex = comboBox.Items.Count - 1;
        }

        private void BindDataList()
        {
            List<LeadBlock> zips1 = (List<LeadBlock>)Session["Zips"];
            List<LeadBlock> zips = new List<LeadBlock>();
            if ((bool)Session["isFilter"])
            {
                zips = CommonUtility.GetZips(zips1,
                    Session["FilterZip"].ToString(), Session["FilterCounty"].ToString(),
                    Session["FilterCity"].ToString(), Session["FilterState"].ToString());
            }
            else
            {
                zips = zips1;
            }
            DataList1.DataSource = zips;
            DataList1.DataBind();
            int sum = 0;
            int currentSelected = 0;
            int activeleads = 0;
            int lapseleads = 0;
            int bussinessleads = 0;
            int neighborleads = 0;
            int cactiveleads = 0;
            int clapseleads = 0;
            int cbussinessleads = 0;
            int cneighborleads = 0;

            for (int i = 0; i < DataList1.Rows.Count; i++)
            {
                 HiddenField hidenDLA = (HiddenField)DataList1.Rows[i].Cells[1].FindControl("ISDLA");
                if (hidenDLA.Value == "True")
                {
                    Label lableDLA = (Label)DataList1.Rows[i].Cells[1].FindControl("LabelDLA");
                    lableDLA.Text = "<a href='#' onclick='showDLA()'>DLA</a>";
                }
                //int rowleads = Convert.ToInt32(DataList1.Rows[i].Cells[8].Text);
                bool isOrderALNInPeriod = false;
                for (int j = 1; j <= 10; j++)
                {
                    if (DataList1.Rows[i].Cells[j + 11].Controls[1].GetType().Name == "CheckBox")
                    {
                        CheckBox cb = (CheckBox)DataList1.Rows[i].Cells[j + 11].Controls[1];
                        if (j == 9 || j == 10)
                        {
                            cb.Enabled = true;
                            cb.Attributes.Add("onclick", "updateWeek(this,'" + DataList1.DataKeys[i].Value+"');setCheck(this);");
                            DataList1.HeaderRow.Cells[j + 11].ForeColor = System.Drawing.Color.Black;
                        }
                        switch (j)
                        {
                            case 1:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFiveALN;
                                break;
                            case 2:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFiveBus;
                                break;
                            case 3:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFourALN;
                                break;
                            case 4:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInFourBus;
                                break;
                            case 5:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInThreeALN;
                                break;
                            case 6:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInThreeBus;
                                break;
                            case 7:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInTwoALN;
                                break;
                            case 8:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInTwoBus;
                                break;
                            case 9:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInOneALN;
                                break;
                            case 10:
                                cb.Checked = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))].IsOrderInOneBus;
                                break;
                        }
                       
                        if (cb.Enabled)
                        {
                            HiddenField assinment = (HiddenField)DataList1.Rows[i].Cells[0].FindControl("AssignMent");
                            //LeadBlock lb = zips[CommonUtility.GetZipIndex(zips, Convert.ToInt32(DataList1.DataKeys[i].Value))]; ((string.IsNullOrEmpty(lb.UserAssigned) ? string.Empty : lb.UserAssigned.Substring(0, 1)) == Session["orderWeek"].ToString().Trim())
                            int orderweek = string.IsNullOrEmpty(assinment.Value) ? 0 : int.Parse(assinment.Value.Split(' ')[0]);
                            string agentName = string.IsNullOrEmpty(assinment.Value) ? string.Empty : assinment.Value.Substring(assinment.Value.IndexOf(' ') + 1).Trim();
                            if (cb.Checked )
                            {
                                if (orderweek == int.Parse(Session["orderWeek"].ToString())&& agentName == Session["agentName"].ToString().Trim() )
                                {
                                    if (j == 9)
                                    {
                                        currentSelected = currentSelected + Convert.ToInt32(DataList1.Rows[i].Cells[8].Text) + Convert.ToInt32(DataList1.Rows[i].Cells[9].Text);
                                        cactiveleads = cactiveleads + Convert.ToInt32(DataList1.Rows[i].Cells[8].Text);
                                        clapseleads = clapseleads + Convert.ToInt32(DataList1.Rows[i].Cells[9].Text);
                                        cneighborleads = cneighborleads + Convert.ToInt32(DataList1.Rows[i].Cells[10].Text);
                                    }
                                    else
                                    {
                                        cbussinessleads = cbussinessleads + Convert.ToInt32(DataList1.Rows[i].Cells[11].Text);
                                    }
                                }
                                isOrderALNInPeriod = true;
                                DataList1.Rows[i].BackColor = System.Drawing.Color.Orange;
                            }
                            else
                            {
                                if (j == 10 && !isOrderALNInPeriod)
                                {
                                    DataList1.Rows[i].BackColor = System.Drawing.Color.White;
                                }
                            }
                        }
                    }
                }
            }

            if (Session["Zips"] != null)
            {
                for (int i = 0; i < zips1.Count; i++)
                {
                    bool iscurweek = string.IsNullOrEmpty(zips1[i].UserAssigned) ? false : int.Parse(zips1[i].UserAssigned.Split(' ')[0]) == int.Parse(Session["orderWeek"].ToString());
                    bool iscuragent = string.IsNullOrEmpty(zips1[i].UserAssigned) ? false : zips1[i].UserAssigned.Substring(zips1[i].UserAssigned.IndexOf(' ') + 1).Trim() == Session["agentName"].ToString().Trim();
             
                  if (iscurweek&&iscuragent)
                    {
                        if (zips1[i].IsOrderInOneALN)
                        {
                            sum = sum + zips1[i].ActiveLeadCount + zips1[i].LapsedLeadCount;
                            activeleads = activeleads + zips1[i].ActiveLeadCount;
                            lapseleads = lapseleads + zips1[i].LapsedLeadCount;
                            neighborleads = neighborleads + zips1[i].NeighborLeadCount;
                        }
                        if (zips1[i].IsOrderInOneBus)
                        {
                            bussinessleads = bussinessleads + zips1[i].BusinessLeadCount;
                        }
                    }
                }
            }

            this.hiddenNum.Value = (sum - currentSelected).ToString();
            this.hiddenActive.Value = (activeleads - cactiveleads).ToString();
            this.hiddenBussiness.Value = (bussinessleads - cbussinessleads).ToString();
            this.hiddenLapse.Value = (lapseleads - clapseleads).ToString();
            this.hiddenNeighbor.Value = (neighborleads - cneighborleads).ToString();
            this.lbActiveLead.Text = activeleads.ToString();
            this.lbBussinessLead.Text = bussinessleads.ToString();
            this.lbLapseLead.Text = lapseleads.ToString();
            this.lbNeighborLead.Text = neighborleads.ToString();
            this.hiddenEstimate.Value = GetActiveLeadCount();
            this.lblLower.Text = SystemConfiguration.CommonSetting.MinStop.ToString();
            this.lblUpper.Text = SystemConfiguration.CommonSetting.MaxStop.ToString();
            this.lblInfoAgent.Text = Session["agentName"].ToString();
            this.lblInfoWeek.Text = Session["orderWeek"].ToString();
            this.hiddenWeekCount.Value = Session["weekCount"].ToString();
            this.hiddenMonth.Value = HttpContext.Current.Session["orderMonth"].ToString();
            this.hiddenYear.Value = HttpContext.Current.Session["orderYear"].ToString();
            this.hiddenLockMonth.Value = SystemConfiguration.CommonSetting.LockMonth.ToString();
            this.hiddenIsRuleRepeatEnalbe.Value = (HttpContext.Current.Session["CurrentUser"] as User).IsRepeatRuleEnabled.ToString();
            this.hiddenIsMDRuleEnalbe.Value = (HttpContext.Current.Session["CurrentUser"] as User).IsRuleEnabled.ToString();
        } 

        [WebMethod]
        public static string GetLastOrderDate(string zipId, string rowIndex)
        {
            List<LeadBlock> zips = HttpContext.Current.Session["Zips"] as List<LeadBlock>;
            string lastOrderDate = string.Empty;

            if (zips != null && zips.Count > 0)
            {
                List<LeadBlock> filterZips = zips.Where(c => c.ZipId == int.Parse(zipId)).ToList<LeadBlock>();

                if (filterZips != null && filterZips.Count > 0)
                {
                    lastOrderDate = filterZips[0].LastOrderDate;
                }
            }

            return lastOrderDate + "|" + rowIndex;
        }
        [WebMethod]
        public static string TransferPara(string type)
        {
            //if (type == "nextWeek")
            //{
            //    HttpContext.Current.Session["orderWeek"] = int.Parse(HttpContext.Current.Session["orderWeek"].ToString()) + 1;
            //}
          
            HttpContext.Current.Session["operateType"] = type;
            return "";
        }
        [WebMethod]
        public static string GetCurWeek()
        {
            return HttpContext.Current.Session["orderWeek"].ToString() + "|" + HttpContext.Current.Session["weekCount"].ToString();
        }
        [WebMethod]
        public static string GetAgent()
        {
            return HttpContext.Current.Session["agentName"].ToString();
        }

        [WebMethod]
        public static void SetCurrentWeek(int week)
        {
            HttpContext.Current.Session["orderWeek"] = week.ToString();
        }

        #endregion

       
    }
}
